<template>
    <view class="notice-detail-container">
        <view class="card-box" v-if="!loading">
            <view class="notice-detail-title">{{ detail.title }}</view>
            <view class="notice-detail-time">{{ detail.create_time }}</view>
            <u-parse :content="detail.content" />
        </view>
        <view class="skeleton-box" v-else>
            <u-skeleton :loading="loading" :rows="5" title avatar-size="20" avatar-radius="50%" :animate="true">
            </u-skeleton>
        </view>
    </view>
</template>

<script>
import { getCommunitynewsNoticeDetail } from '@/api/index.js'
export default {
    name: 'Notice',
    data() {
        return {
            id: '',
            detail: {},
            loading: true
        }
    },
    onLoad(option) {
        this.id = option.id
        this.getNoticeDetail()
    },
    methods: {
        async getNoticeDetail() {
            this.loading = true
            const res = await getCommunitynewsNoticeDetail({id: this.id})
            this.detail = res.data
            this.loading = false
        }
    }
}
</script>

<style lang="scss" scoped>
.notice-detail-container {
    width: 100%;
    min-height: 100vh;
    background: #f5f5f5;
    padding: 28rpx 32rpx;
    box-sizing: border-box;


    .card-box {
        background: #fff;
        border-radius: 20rpx;
        padding: 28rpx;
        box-sizing: border-box;
        box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0,0,0,0.06);
        border-radius: 20rpx 20rpx 20rpx 20rpx;

        .notice-detail-title {
            font-size: 30rpx;
            color: #333333;
            font-weight: bold;
        }

        .notice-detail-time {
            font-size: 20rpx;
            color: #999999;
            margin: 8rpx 0 28rpx;
        }

        .skeleton-box {
            background: #fff;
            padding: 28rpx;
            box-sizing: border-box;
            box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0,0,0,0.06);
            border-radius: 20rpx 20rpx 20rpx 20rpx;
        }
    }
}
</style>